package service.impl;
import service.MoralScoresService;
import entity.MoralScores;
import mapper.MoralScoresMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class MoralScoresImpl implements MoralScoresService {
    @Autowired
    private MoralScoresMapper mapper;

    public MoralScores selectById(Integer id)
    {
        return mapper.selectById(id);
    }
    public List<MoralScores> selectAll()
    {
        return mapper.selectAll();
    }
    @Override
    public List<MoralScores> selectByStudentId(Integer sid)
    {
        return mapper.selectByStudentId(sid);
    }

    public int create(MoralScores m) {
        m.setCreatedAt(LocalDateTime.now());
        return mapper.insert(m);
    }
    public int update(MoralScores m) {
        m.setUpdatedAt(LocalDateTime.now());
        return mapper.update(m);
    }
    public int delete(Integer id) { return mapper.delete(id); }
}